package com.wiscamp.ninechapters.tags.infrastructure.converters;

import com.wiscamp.ninechapters.tags.domain.models.Subject;
import com.wiscamp.ninechapters.tags.infrastructure.po.SubjectPO;
import com.wiscamp.ninechapters.tags.infrastructure.po.SubjectView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface SubjectConverter {
    SubjectConverter Instance = Mappers.getMapper(SubjectConverter.class);

    SubjectPO toSubjectPO(Subject entity);

    SubjectPO toSubjectPO(Subject entity, @MappingTarget SubjectPO po);

    Subject toSubject(SubjectPO po);

    Subject toSubjectByView(SubjectView view);
}
